// pages/sports/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
     sports:[
         {
             img:'../../images/跑步.png',
             name:'跑步',
             kalo:'7.3',
             type:0
         },
         {
             img:'../../images/sports/篮球.png',
             name:'打篮球',
             kalo:'8.0',
             type:1
         },
         {
             img:'../../images/sports/羽毛球.png',
             name:'羽毛球',
             kalo:'5.5',
             type:2
         },
         {
             img:'../../images/sports/瑜伽.png',
             name:'瑜伽',
             kalo:'6.3',
             type:3
         },
         {
             img:'../../images/sports/乒乓球.png',
             name:'乒乓球',
             kalo:'7.3',
             type:4
         },
         {
             img:'../../images/sports/舞蹈.png',
             name:'舞蹈',
             kalo:'7.3',
             type:5
         },
         {
             img:'../../images/sports/游泳.png',
             name:'游泳',
             kalo:'7.3',
             type:6
         },


     ],
     show:false,
     isshow:{},
     time:'25'
  },
  isShowing(e){
   console.log(e)
   const {item}=e.currentTarget.dataset
   if(item.type==0){
    wx.navigateTo({
        url: '/pages/runmap/index',
      })
   }else{
    this.setData({
        isshow:item,
        show:true
    })
   }
  },
  offshow(){
   this.setData({
       show:false
   })
  },
  slider1change(e){
      console.log(e)
    this.setData({
       time:e.detail.value
   })
  },
  goDetail(e){
      console.log(e)
      const {item}=e.currentTarget.dataset
      if(item.type===0){
          wx.navigateTo({
            url: '/pages/runmap/index',
          })
      }else{
          wx.navigateTo({
            url: '/pages/sports_item/index?item='+encodeURIComponent(JSON.stringify(item)),
          })
      }
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})